package org.omich.loaves;

import java.util.ArrayList;

public class Loaves {
	void addLoaf (int weight) {
		loaves.add(new Loaf(weight));
	}
	
	void tryToEat(String eater, int number) {
		if (!loaves.get(number - 1).isFree())
			return;
		for (Loaf loaf : loaves) {
		    if (loaf.GetEater() == eater && loaf.isEating())
		    	return;
		}
		loaves.get(number - 1).startEating(eater);
	}
	
	public ArrayList<Loaf> getStore() { return loaves; }
	
	private ArrayList<Loaf> loaves = new ArrayList<Loaf>();
}
